package dev.werillib.android

import android.annotation.SuppressLint
import android.content.Context
import android.widget.Toast

object ToastUtil {
    private var toast: Toast? = null

    @SuppressLint("ShowToast")
    fun toast(context: Context, str: String?) {
        if (str != null && !str.isEmpty()) {
            if (toast == null) {
                toast = Toast.makeText(context, str, Toast.LENGTH_SHORT)
            } else {
                toast!!.setText(str)
            }
            toast!!.show()
        }
    }
}